<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>sticky吸顶</title>
  <style>
    div.sticky {
      position: -webkit-sticky;
      position: sticky;
      top: 0;
      padding: 5px;
      background-color: #cae8ca;
      border: 2px solid #4CAF50;
    }
  </style>
</head>
<body>

<p>尝试滚动页面。</p>

<div>
  <div class="sticky" style="z-index: 1">我是粘性定位!</div>

  <div>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>


  </div>

  <div class="sticky" style="z-index: 2">我是粘性定位02!</div>
  <div >
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>
    <p>滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动滚动</p>


  </div>
</div>
</body>
</html>
